<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
	<meta content="yes" name="apple-mobile-web-app-capable">
	<meta content="black" name="apple-mobile-web-app-status-bar-style">
	<meta content="telephone=no" name="format-detection">
	<meta content="no-cache" http-equiv="Cache-Control">
	<title>源之东方商城</title>
	<link href="__STATIC__/css/shopin.css" rel="stylesheet"/>
</head>

<body>
<div class="header">
	<div class="left"><a href="javascript:;" class="a-back"><span>返回</span></a></div>
	<div class="center">
		<h1>消息列表</h1>
	</div>
</div><!--//头部结束-->

<div class="content">
	{if ($messgae)}
	{volist name="messgae" id="v"}
	<div class="m-address">
		<div class="address manage-address">
			<div class="info">
				发送人：<p class="name">{$v.nickname}</p>
			</div>
			<div class="address-bottom">
				<label><input type="checkbox" checked disabled>{$v.msg_contents}</label>
				<div class="operate ">
					<a href="javascript:;" class="j-address-edit">已读</a>
				</div>
			</div>
		</div><!-- //收货地址 -->
	{/volist}
	{else}
		<div class="m-address">
			<div class="address manage-address">
				<div class="info">
					暂无消息
				</div>
			</div><!-- //收货地址 -->
	{/if}
	</div>
	<script src="__STATIC__/js/zepto.min.js"></script>
	<script src="__STATIC__/js/shopin.js"></script>
	<script>
		$('#actionBtn').on('tap', function(){
			loading();//显示loading方法  关闭：closeLoad()
			if($('.m-address').is(':visible') && $('.edit-address').is(':hidden')){
				$('.m-address').css('display','none');
				$('.edit-address').css('display','block');
				$(this).text('保存地址');
			}else{
				if($("#name").val() == ""){
					alert('你没写名字！');
					$("#name").focus();
					return false;
				}
				if($("#phone").val() == ""){
					alert('你没写电话！');
					$("#phone").focus();
					return false;
				}
				if($("#addressDetail").val() == ""){
					alert('请填写详细地址！');
					$("#addressDetail").focus();
					return false;
				}
				$('.m-address').css('display','block');
				$('.edit-address').css('display','none');
				$(this).text('新增收货地址');
				newAddress();
			}
		});
		function newAddress(){
			var _name = $('#name').val();
			var _phone = $('#phone').val();
			var _zipcode = $('#zipcode').val();
			var _province = $('#province').find("option:selected").text();
			var _city = $('#city').find("option:selected").text();
			var _addressDetail = $('#addressDetail').val();
			var _html = "<div class=\"address confirm-address\"><div class=\"info\">收货人：<p class=\"name\">" + _name + "</p><p class=\"phone\">" + _phone + "</p></div><div class=\"details\">收货地址：" + _province + _city + _addressDetail + "</div></div>";
			$('.j_myaddress').append(_html);
			//ajax保存地址
		};
	</script>
</body>
</html>